Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix negative ammo in quivers #40259

Merged

Conversation

KorGgenT
Copy link
Member

@KorGgenT KorGgenT commented May 6, 2020

Summary

SUMMARY: Bugfixes "fixes negative ammo in bandoliers and quivers"

Purpose of change

Fixes #40166
Fixes #40207

Describe the solution

item_pocket::overflow() had some bad logic for ammo_restriction items. i adjusted the if statement to properly check if the ammo overflows.
Additionally, when debugging this, i noticed that pick_one_up was causing a debug message because of Character::add_to_container(). i made this call Character::i_add() instead, because that function already has logic for searching for the best pocket, and handling if it doesn't find it.

Describe alternatives you've considered

Testing

sownloaded the save in #40207 and followed the steps - the number kept going more and more negative, and you kept dropping negative arrows so it was obvious to me that it had something to do with item_pocket::overflow.

Additional context

i'm not really sure why Character::add_item_to_container() exists... i guess maybe so you can pick up partial items? but you can already do that with get, so i'm not really sure.

@KorGgenT KorGgenT added Items: Magazines Ammo holding items and objects. <Bugfix> This is a fix for a bug (or closes open issue) labels May 6, 2020
@KorGgenT KorGgenT marked this pull request as draft May 6, 2020 18:25
@KorGgenT KorGgenT force-pushed the fix-negative-ammo-in-quivers branch from a3b0747 to b8488bd Compare May 6, 2020 18:59
@KorGgenT KorGgenT marked this pull request as ready for review May 6, 2020 19:00
@ZhilkinSerg ZhilkinSerg merged commit 8513b65 into CleverRaven:master May 6, 2020
@KorGgenT KorGgenT deleted the fix-negative-ammo-in-quivers branch August 13, 2020 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) Items: Magazines Ammo holding items and objects.
Projects
None yet
2 participants